package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.PurchaseOrderBean;
import com.project.service.IPurchaseOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * 采购车订单控制器
 */

@RestController
@RequestMapping("purchaseOrder")
@RequiresPermissions("outOrderInfo:am")
public class PurchaseOrderController {
    @Autowired
    private IPurchaseOrderService purchaseOrderService;
    @RequestMapping("cutByItem")
    public IPage<PurchaseOrderBean> cutByItem(Integer pageNO, String provider, LocalDate startDate, LocalDate endDate){
        return purchaseOrderService.cutByItem(pageNO, provider, startDate, endDate);
    }

    /**
     * 根据采购id，查询采购基本信息，同时查询该采购明细信息，在采购明细信息中，需要查询商品名称和品牌
     * @param purchaseOrderId 采购订单ID
     * @return 采购订单对象
     */
    @RequestMapping("findOrderById")
    public PurchaseOrderBean findOrderById(Integer purchaseOrderId){
        return purchaseOrderService.findOrderById(purchaseOrderId);
    }
}
